﻿using System.Linq;
using System.Web.Mvc;
using MVCLD.Models;
using MVCLD.Settings;

namespace MVCLD.Controllers
{
    [HandleError]
    public class HomeController : ApplicationController
    {

        #region Data Access
        MVCLDServiceModels db = new MVCLDServiceModels(); 
        #endregion

        public ActionResult Index()
        {         
            ViewData["LatestWebsites"] = db.GetLatestSubmittedArticlesByAmount(Settings.Settings.GeneralHomePageLatestSiteAmount);
            return View(db.GetAllMainCategories().ToList());
        }

        public ActionResult about()
        {
            return View();
        }

        public ActionResult sitemap()
        {
            ViewData["AllCategories"] = db.GetAllCategories().ToList();   
            return View();
        }

    }
}
